<template>
	<view>
		<view :style="{ height: titleHeight.statusBarHeight + 'px'}"></view>
		<uv-row v-if="backTitle"
		        justify="space-between"
		        gutter="10"
				class="search-top"
		    >
			<uv-col span="1">
				<view class="search-font" @click="goback">
					<uv-icon name="arrow-left" color="#666" size="20"></uv-icon>
				</view>
			</uv-col>
			<uv-col span="10" style="text-align: center;">
				{{backTitle}}
			</uv-col>
			<uv-col span="1"></uv-col>
		</uv-row>
	</view>
</template>

<script>
	export default {
		name:"topHeight",
		props: {
			backTitle: { //遮罩层的类型 （必须在config里面的定义的）
				type: String,
				default: null
			}
		},
		data() {
			return {
				titleHeight: {
					statusBarHeight: uni.getStorageSync('statusBarHeight') || 0
				}
			};
		},
		mounted() {
			this.stytemInfo();
		},
		methods: {
			// 获取系统信息
			stytemInfo:function(){
				var that = this;
				uni.getSystemInfo({
					success: function (res) {
						that.titleHeight = res;
						uni.setStorageSync("statusBarHeight", that.titleHeight.statusBarHeight)
					}
				});
			},
			goback(){
				uni.navigateBack()
			},
		}
	}
</script>

<style scoped>
	.search-top{
		padding: 22rpx 40rpx;
	}
</style>